package br.com.bancodecurriculos.util.properties;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class PropertiesFactory {

	private static PropertiesFactory instance;

	private PropertiesFactory() {

	}

	public static PropertiesFactory getInstance() {
		if (instance == null) {
			instance = new PropertiesFactory();
		}
		return instance;
	}

	public String getProperty(String path, String key) throws IOException {
		Properties properties = this.getPropertiesFile(PropertiesFactory.class
				.getResource(path).getPath());
		return properties.getProperty(key);
	}

	private Properties getPropertiesFile(String path) throws IOException {
		Properties properties = new Properties();
		FileInputStream fileInputStream = new FileInputStream(path);
		properties.load(fileInputStream);
		return properties;
	}

}
